package com.example.rvdemo.common;


import android.content.Context;

import com.example.rvdemo.R;
import com.example.rvdemo.common.commonAdaptar.MulitiTypeSupport;
import com.example.rvdemo.common.commonAdaptar.RecyclerCommonAdapter;
import com.example.rvdemo.common.commonAdaptar.ViewHolder;

import java.util.List;

public class ChatAdaptar extends RecyclerCommonAdapter<ChatData> {
    public ChatAdaptar(Context context, List<ChatData> datas) {
        super(context, datas, new MulitiTypeSupport<ChatData>() {
            @Override
            public int getLayoutId(ChatData chatData) {
                if (chatData.isMe == 1) {
                    return R.layout.item_chat_me;
                }
                return R.layout.item_chat_friend;
            }
        });
    }

    @Override
    protected void convert(ViewHolder holder, ChatData chatData, int position) {
        holder.setText(R.id.chat_text,chatData.chatContent);
    }
}
